pub mod input;
pub mod output;

pub mod unicode_control_characters {
    pub const NULL: u16 = 0;
    /// Backspace，将游标向左移动一列，如果游标在左边缘，则不采取行动。
    pub const BS: u16 = 8;
    pub const TAB: u16 = 9;
    /// Linefeed，将游标移动到下一行。
    pub const LF: u16 = 0xa;
    /// Carriage Return，将游标移动到当前行的左边缘。
    pub const CR: u16 = 0xd;
}
pub mod scan_code {
    pub const NULL: u16 = 0;
    pub const UP: u16 = 1;
    pub const DOWN: u16 = 2;
    pub const RIGHT: u16 = 3;
    pub const LEFT: u16 = 4;
    pub const HOME: u16 = 5;
    pub const END: u16 = 6;
}

pub mod unicode_drawing_characters {
    pub mod box_draws {
        pub const HORIZONTAL: u16 = 0x2500;
        pub const VERTICAL: u16 = 0x2502;
        pub const DOWN_RIGHT: u16 = 0x250c;
        pub const DOWN_LEFT: u16 = 0x2510;
        pub const UP_RIGHT: u16 = 0x2514;
        pub const UP_LEFT: u16 = 0x2518;
        pub const VERTICAL_RIGHT: u16 = 0x251c;
        pub const VERTICAL_LEFT: u16 = 0x2524;
        pub const DOWN_HORIZONTAL: u16 = 0x252c;
        pub const UP_HORIZONTAL: u16 = 0x2534;
        pub const VERTICAL_HORIZONTAL: u16 = 0x253c;
        pub const DOUBLE_HORIZONTAL: u16 = 0x2550;
        pub const DOUBLE_VERTICAL: u16 = 0x2551;
        pub const DOWN_RIGHT_DOUBLE: u16 = 0x2552;
        pub const DOWN_DOUBLE_RIGHT: u16 = 0x2553;
        pub const DOUBLE_DOWN_RIGHT: u16 = 0x2554;
        pub const DOWN_LEFT_DOUBLE: u16 = 0x2555;
        pub const DOWN_DOUBLE_LEFT: u16 = 0x2556;
        pub const DOUBLE_DOWN_LEFT: u16 = 0x2557;
        pub const UP_RIGHT_DOUBLE: u16 = 0x2558;
        pub const UP_DOUBLE_RIGHT: u16 = 0x2559;
        pub const DOUBLE_UP_RIGHT: u16 = 0x255a;
        pub const UP_LEFT_DOUBLE: u16 = 0x255b;
        pub const UP_DOUBLE_LEFT: u16 = 0x255c;
        pub const DOUBLE_UP_LEFT: u16 = 0x255d;
        pub const VERTICAL_RIGHT_DOUBLE: u16 = 0x255e;
        pub const VERTICAL_DOUBLE_RIGHT: u16 = 0x255f;
        pub const DOUBLE_VERTICAL_RIGHT: u16 = 0x2560;
        pub const VERTICAL_LEFT_DOUBLE: u16 = 0x2561;
        pub const VERTICAL_DOUBLE_LEFT: u16 = 0x2562;
        pub const DOUBLE_VERTICAL_LEFT: u16 = 0x2563;
        pub const DOWN_HORIZONTAL_DOUBLE: u16 = 0x2564;
        pub const DOWN_DOUBLE_HORIZONTAL: u16 = 0x2565;
        pub const DOUBLE_DOWN_HORIZONTAL: u16 = 0x2566;
        pub const UP_HORIZONTAL_DOUBLE: u16 = 0x2567;
        pub const UP_DOUBLE_HORIZONTAL: u16 = 0x2568;
        pub const DOUBLE_UP_HORIZONTAL: u16 = 0x2569;
        pub const VERTICAL_HORIZONTAL_DOUBLE: u16 = 0x256a;
        pub const VERTICAL_DOUBLE_HORIZONTAL: u16 = 0x256b;
        pub const DOUBLE_VERTICAL_HORIZONTAL: u16 = 0x256c;
    }

    pub mod block_elements {
        pub const FULL_BLOCK: u16 = 0x2588;
        pub const LIGHT_SHADE: u16 = 0x2591;
    }

    pub mod geometric_shapes {
        pub const UP_TRIANGLE: u16 = 0x25b2;
        pub const RIGHT_TRIANGLE: u16 = 0x25ba;
        pub const DOWN_TRIANGLE: u16 = 0x25bc;
        pub const LEFT_TRIANGLE: u16 = 0x25c4;
    }

    pub mod arrow_shapes {
        pub const UP: u16 = 0x2191;
        pub const DOWN: u16 = 0x2193;
    }
}

pub mod attribute {
    pub const EFI_BLACK: usize = 0x00;
    pub const EFI_BLUE: usize = 0x01;
    pub const EFI_GREEN: usize = 0x02;
    pub const EFI_CYAN: usize = 0x03;
    pub const EFI_RED: usize = 0x04;
    pub const EFI_MAGENTA: usize = 0x05;
    pub const EFI_BROWN: usize = 0x06;
    pub const EFI_LIGHTGRAY: usize = 0x07;
    /// 同样的值还有：`#define EFI_DARKGRAY(EFI_BLACK | EFI_BRIGHT) 0x08`，但不知道啥意思。
    pub const EFI_BRIGHT: usize = 0x08;
    pub const EFI_LIGHTBLUE: usize = 0x09;
    pub const EFI_LIGHTGREEN: usize = 0x0A;
    pub const EFI_LIGHTCYAN: usize = 0x0B;
    pub const EFI_LIGHTRED: usize = 0x0C;
    pub const EFI_LIGHTMAGENTA: usize = 0x0D;
    pub const EFI_YELLOW: usize = 0x0E;
    pub const EFI_WHITE: usize = 0x0F;
    pub const EFI_BACKGROUND_BLACK: usize = 0x00;
    pub const EFI_BACKGROUND_BLUE: usize = 0x10;
    pub const EFI_BACKGROUND_GREEN: usize = 0x20;
    pub const EFI_BACKGROUND_CYAN: usize = 0x30;
    pub const EFI_BACKGROUND_RED: usize = 0x40;
    pub const EFI_BACKGROUND_MAGENTA: usize = 0x50;
    pub const EFI_BACKGROUND_BROWN: usize = 0x60;
    pub const EFI_BACKGROUND_LIGHTGRAY: usize = 0x70;
    /// 用于前景色的值必须在 EFI_BLACK ~ EFI_WHITE 之间。
    /// 用于背景色的值则只能是：EFI_BLACK, EFI_BLUE, EFI_GREEN, EFI_CYAN, EFI_RED, EFI_MAGENTA, EFI_BROWN, and EFI_LIGHTGRAY。
    /// 本函数不要使用任何 EFI_BACKGROUND_XXX 值。
    pub const fn text_attr(foreground: usize, background: usize) -> usize {
        foreground | (background << 4)
    }
}
